package com.orharlan.carassistant.datamodel;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

import com.orharlan.carassistant.features.GetWeather;
import com.orharlan.carassistant.features.PersistenceXML;
import com.orharlan.carassistant.features.SaveGpsBtListener;

public class Datamodel
{
	private static Datamodel data;
	private SaveGpsBtListener saveGpsBtListener;
	private PropertyChangeSupport carLocationPC = new PropertyChangeSupport( this );
	private PersistenceXML persXml;
	private double currentLatitude;
	private double currentLongitude;

	// This variables are persistence as a data storage on the internal memory
	// as XML
	private double carLatitude;
	private double carLongitude;
	private double homeLatitude;
	private double homeLongitude;
	private double jobLatitude;
	private double jobLongitude;
	private String mailAddress = "";

	// Data of Weather
	private String location = "";
	private static GetWeather getWeather;
	private String temperature = Integer.MAX_VALUE + "";
	private String date = "";
	private String humidity = "";

	private String description = "";
	private String city = "";
	private String region = "";
	private String country = "";

	private String windChill = "";
	private String windDirection = "";
	private String windSpeed = "";

	private String atmosphereChill = "";
	private String atmosphereVisibility = "";
	private String atmospherePressure = "";
	private String atmosphereRising = "";

	private String sunrise = "";
	private String sunset = "";

	private String conditiontext = "";
	private String conditiondate = "";

	private String woeid = "";

	protected Datamodel( )
	{

		// TODO hier alle variablen deklartieren die gerade oben inititalisiert
		// werden!!!!!!!!
	}

	public PropertyChangeSupport getCarLocationPC( )
	{
		return carLocationPC;
	}

	public void setCarLocationPC( PropertyChangeSupport carLocationPC )
	{
		this.carLocationPC = carLocationPC;
	}

	public String getWoeid( )
	{
		return woeid;
	}

	public void setWoeid( String woeid )
	{
		this.woeid = woeid;
	}

	public String getTemperature( )
	{
		return temperature;
	}

	public void setTemperature( String temperature )
	{
		this.temperature = temperature;
	}

	public String getDate( )
	{
		return date;
	}

	public void setDate( String date )
	{
		this.date = date;
	}

	public String getHumidity( )
	{
		return humidity;
	}

	public void setHumidity( String humidity )
	{
		this.humidity = humidity;
	}

	public String getDescription( )
	{
		return description;
	}

	public void setDescription( String description )
	{
		this.description = description;
	}

	public String getCity( )
	{
		return city;
	}

	public void setCity( String city )
	{
		this.city = city;
	}

	public String getRegion( )
	{
		return region;
	}

	public void setRegion( String region )
	{
		this.region = region;
	}

	public String getCountry( )
	{
		return country;
	}

	public void setCountry( String country )
	{
		this.country = country;
	}

	public String getWindChill( )
	{
		return windChill;
	}

	public void setWindChill( String windChill )
	{
		this.windChill = windChill;
	}

	public String getWindDirection( )
	{
		return windDirection;
	}

	public void setWindDirection( String windDirection )
	{
		this.windDirection = windDirection;
	}

	public String getWindSpeed( )
	{
		return windSpeed;
	}

	public void setWindSpeed( String windSpeed )
	{
		this.windSpeed = windSpeed;
	}

	public String getAtmosphereChill( )
	{
		return atmosphereChill;
	}

	public void setAtmosphereChill( String atmosphereChill )
	{
		this.atmosphereChill = atmosphereChill;
	}

	public String getAtmosphereVisibility( )
	{
		return atmosphereVisibility;
	}

	public void setAtmosphereVisibility( String atmosphereVisibility )
	{
		this.atmosphereVisibility = atmosphereVisibility;
	}

	public String getAtmospherePressure( )
	{
		return atmospherePressure;
	}

	public void setAtmospherePressure( String atmospherePressure )
	{
		this.atmospherePressure = atmospherePressure;
	}

	public String getAtmosphereRising( )
	{
		return atmosphereRising;
	}

	public void setAtmosphereRising( String atmosphereRising )
	{
		this.atmosphereRising = atmosphereRising;
	}

	public String getSunrise( )
	{
		return sunrise;
	}

	public void setSunrise( String sunrise )
	{
		this.sunrise = sunrise;
	}

	public String getSunset( )
	{
		return sunset;
	}

	public void setSunset( String sunset )
	{
		this.sunset = sunset;
	}

	public String getConditiontext( )
	{
		return conditiontext;
	}

	public void setConditiontext( String conditiontext )
	{
		this.conditiontext = conditiontext;
	}

	public String getConditiondate( )
	{
		return conditiondate;
	}

	public void setConditiondate( String conditiondate )
	{
		this.conditiondate = conditiondate;
	}

	public static Datamodel singleton( )
	{
		if( data == null )
		{
			data = new Datamodel( );
		}
		return data;
	}

	public double getCarLatitude( )
	{
		return carLatitude;
	}

	public double getCarLongitude( )
	{
		return carLongitude;
	}

	public double getHomeLatitude( )
	{
		return homeLatitude;
	}

	public double getHomeLongitude( )
	{
		return homeLongitude;
	}

	public double getJobLatitude( )
	{
		return jobLatitude;
	}

	public double getJobLongitude( )
	{
		return jobLongitude;
	}

	public double getCurrentLatitude( )
	{
		return currentLatitude;
	}

	public double getCurrentLongitude( )
	{
		return currentLongitude;
	}

	public void setCurrentLocation( double latitude, double longitude )
	{
		this.currentLatitude = latitude;
		this.currentLongitude = longitude;
		carLocationPC.firePropertyChange( "currentLocationPC", carLatitude + carLongitude, latitude + longitude );
	}

	public void setCarLocation( double latitude, double longitude )
	{
		carLocationPC.firePropertyChange( "carLocationPC", carLatitude + carLongitude, latitude + longitude );
		this.carLatitude = latitude;
		this.carLongitude = longitude;
	}

	public void setHomeLocation( double latitude, double longitude )
	{
		carLocationPC.firePropertyChange( "homeLocationPC", homeLatitude + homeLongitude, latitude + longitude );
		this.homeLatitude = latitude;
		this.homeLongitude = longitude;
	}

	public void setJobLocation( double latitude, double longitude )
	{
		carLocationPC.firePropertyChange( "jobLocationPC", jobLatitude + jobLongitude, latitude + longitude );
		this.jobLatitude = latitude;
		this.jobLongitude = longitude;
	}

	public SaveGpsBtListener getSaveGpsBtListener( )
	{
		return saveGpsBtListener;
	}

	public void setSaveGpsBtListener( SaveGpsBtListener saveGpsBtListener )
	{
		this.saveGpsBtListener = saveGpsBtListener;
	}

	public String getMailAddress( )
	{
		return mailAddress;
	}

	public void setMailAddress( String mailAddress )
	{
		this.mailAddress = mailAddress;
	}

	public void addPropertyChangeListener( PropertyChangeListener l )
	{
		carLocationPC.addPropertyChangeListener( l );
	}

	public void removePropertyChangeListener( PropertyChangeListener l )
	{
		carLocationPC.removePropertyChangeListener( l );
	}

	public static com.orharlan.carassistant.features.GetWeather getGetWeather( )
	{
		return getWeather;
	}

	public static void setGetWeather( com.orharlan.carassistant.features.GetWeather getWeather )
	{
		Datamodel.getWeather = getWeather;
	}

	public String getLocation( )
	{
		return location;
	}

	public void setLocation( String location )
	{
		this.location = location;
	}

	public PersistenceXML getPersXml( )
	{
		return persXml;
	}

	public void setPersXml( PersistenceXML persXml )
	{
		this.persXml = persXml;
	}

}
